package com.xm.servlet.background.employee;

import com.google.gson.Gson;
import com.xm.entity.AdministratorInformation;
import com.xm.service.background.AdministratorInformationService;
import lombok.SneakyThrows;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 员工Servlet
 * @author 陈盼
 * @date 2023-01-18 下午 02:10
 */
@WebServlet("/background/get/employee/and/departments")
public class GetEmployeeAndDepartmentsServlet extends HttpServlet {
    private final AdministratorInformationService service = new AdministratorInformationService();

    @SneakyThrows(Exception.class)
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)  {
        resp.setContentType("text/html;charset=utf-8");
        String name=req.getParameter("name");
        System.out.println(name);
        resp.getWriter().print(new Gson().toJson(service.getFindName(name)));
    }
}
